{% extends "base.html" %}

{% block content %}
    <table class="gridtable" style="margin: auto;">
        {% for l in range(0, line, num) %}
            <tr>
                {% for index in range(num) %}
                    <td>
                        <a href="{{ url('manage', 'info', url=all_source[l+index]) }}">{{ all_source[l+index] }}</a>
                    </td>
                {% endfor %}
            </tr>
        {% endfor %}
        {% if div != 0 %}
            <tr>
                {% for i in range(div) %}
                    <td>
                        <a href="{{ url('manage', 'info', url=all_source[line*num+i]) }}">{{ all_source[line*num+i] }}</a>
                        <a href="" class="del" style="float: right">删除</a>
                    </td>
                {% endfor %}
            </tr>
        {% endif %}
    </table>
{% endblock %}

{% block js %}
    <script>
        $(function () {
            $('.del').click(function () {
                var netloc = $(this).prev().text();
                $.ajax({
                    url: "{{ url ('manage', 'netloc_delete') }}",
                    type: 'GET',
                    data: {"netloc": netloc},
                    success: function (data) {
                        if (data.code === 1000){
                            location.reload()
                        }
                    }
                });
                return false;
            })
        })
    </script>
{% endblock %}